package entity.zhujie.lianxi.demo02;

public class ZongHeSum {
    public int getSum(@CalculatedSumAnnotation(100) int n) {

        if (n <= 0) {
            throw new IllegalArgumentException("参数必须大于0");
        }
        int sum = 0;
        for (int i = 1; i <= n; i++) {
            sum += i;
        }
        return sum;
    }
}
